package com.fandy.struts.DAL;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.fandy.struts.SqlAccess.SqlServerHelper;
import com.fandy.struts.SqlStatement.Staff;


public class DALStaff {
 
	
	Staff s  = new Staff();
	SqlServerHelper ssh = new SqlServerHelper(); 
	
	public   ResultSet  getAll()
	{
		return    ssh.executeScalar(s.getAll()) ;
	}
	
	public   int  Add(com.fandy.struts.Model.Staff stf) throws SQLException
	{
		return    ssh.executeNoQuery(s.Add(stf)) ;
	}
	
	public   ResultSet getStaffInfoByID(int ID)
	{
		return  ssh.executeScalar(s.getStaffInfoByID(ID));
	}
		
	
	public   ResultSet getStaffInfoByName(String userName)
	{
		return  ssh.executeScalar(s.getStaffInfoByName(userName));
	}
		
	
	public   ResultSet  existStaff4Login(com.fandy.struts.Model.Staff stf)
	{
		return   ssh.executeScalar(s.existStaff4Login(stf));
	}
	
	public   ResultSet  existStaff(String Name)
	{
		return   ssh.executeScalar(s.existStaff(Name));
	}
	
	public int UpdateByID(int id,com.fandy.struts.Model.Staff stf) throws SQLException
	{
		
		return ssh.executeNoQuery(s.UpdateByID(id, stf));
		
	}
	
	public int DeleteByID(int id) throws SQLException
	{
		
		return ssh.executeNoQuery(s.DeleteByID(id));
		
	}
	
	
	
}

